home *** CD-ROM | disk | FTP | other *** search
/ Winzipper / Winzipper_ISO.iso / programming / oracle7 7.2 / DB / UTIL72 / CATJOBQ.SQL < prev    next >
Encoding:
Text File  |  1995-05-09  |  7.4 KB  |  218 lines

  1. rem 
  2. rem $Header: catjobq.sql 7020100.1 94/09/23 22:14:05 cli Generic<base> $ 
  3. rem 
  4. Rem  Copyright (c) 1992 by Oracle Corporation 
  5. Rem    NAME
  6. Rem      catjobq.sql - Catalog views for the job queue
  7. Rem    DESCRIPTION
  8. Rem 
  9. Rem    NOTES
  10. Rem     This script must be run while connected as SYS or INTERNAL.
  11. Rem    MODIFIED   (MM/DD/YY)
  12. Rem     wmaimone   05/06/94 -  #184921 run as sys/internal
  13. Rem     rjenkins   01/19/94 -  merge changes from branch 1.1.710.1
  14. Rem     rjenkins   12/20/93 -  Branch_for_patch
  15. Rem     rjenkins   12/17/93 -  Creation
  16.  
  17. remark
  18. remark  FAMILY JOB QUEUE
  19. remark
  20.  
  21. create or replace view DBA_JOBS_RUNNING as
  22.   select v.SID, v.id2 JOB, j.FAILURES,
  23.     LAST_DATE, substr(to_char(last_date,'HH24:MI:SS'),1,8) LAST_SEC, 
  24.     THIS_DATE, substr(to_char(this_date,'HH24:MI:SS'),1,8) THIS_SEC 
  25.   from sys.job$ j, v$lock v 
  26.   where v.type = 'JQ' and j.job (+)= v.id2
  27. /
  28. comment on table DBA_JOBS_RUNNING is
  29. 'All jobs in the database which are currently running, join v$lock and job$'
  30. /
  31. comment on column DBA_JOBS_RUNNING.SID is
  32. 'Identifier of process which is executing the job.  See v$lock.'
  33. /
  34. comment on column DBA_JOBS_RUNNING.JOB is
  35. 'Identifier of job.  This job is currently executing.'
  36. /
  37. comment on column DBA_JOBS_RUNNING.LAST_DATE is
  38. 'Date that this job last successfully executed'
  39. /
  40. comment on column DBA_JOBS_RUNNING.LAST_SEC is
  41. 'Same as LAST_DATE.  This is when the last successful execution started.'
  42. /
  43. comment on column DBA_JOBS_RUNNING.THIS_DATE is
  44. 'Date that this job started executing (usually null if not executing)'
  45. /
  46. comment on column DBA_JOBS_RUNNING.THIS_SEC is
  47. 'Same as THIS_DATE.  This is when the last successful execution started.'
  48. /
  49. comment on column DBA_JOBS_RUNNING.FAILURES is
  50. 'How many times has this job started and failed since its last success?'
  51. /
  52. drop public synonym DBA_JOBS_RUNNING
  53. /
  54. create public synonym DBA_JOBS_RUNNING for DBA_JOBS_RUNNING
  55. /
  56.  
  57.  
  58. remark  Remember to add comments for all_jobs and user_jobs too
  59. create or replace view DBA_JOBS as
  60.   select JOB, lowner LOG_USER, powner PRIV_USER, cowner SCHEMA_USER,
  61.     LAST_DATE, substr(to_char(last_date,'HH24:MI:SS'),1,8) LAST_SEC, 
  62.     THIS_DATE, substr(to_char(this_date,'HH24:MI:SS'),1,8) THIS_SEC, 
  63.     NEXT_DATE, substr(to_char(next_date,'HH24:MI:SS'),1,8) NEXT_SEC, 
  64.     (total+(sysdate-nvl(this_date,sysdate)))*86400 TOTAL_TIME,
  65.     decode(mod(FLAG,2),1,'Y',0,'N','?') BROKEN,
  66.     INTERVAL, FAILURES, WHAT, 
  67.     cur_ses_label CURRENT_SESSION_LABEL, CLEARANCE_HI, CLEARANCE_LO, 
  68.     nlsenv NLS_ENV, env MISC_ENV
  69.   from sys.job$ j
  70. /
  71. comment on table DBA_JOBS is
  72. 'All jobs in the database'
  73. /
  74. comment on column DBA_JOBS.JOB is
  75. 'Identifier of job.  Neither import/export nor repeated executions change it.'
  76. /
  77. comment on column DBA_JOBS.LOG_USER is
  78. 'USER who was logged in when the job was submitted'
  79. /
  80. comment on column DBA_JOBS.PRIV_USER is
  81. 'USER whose default privileges apply to this job'
  82. /
  83. comment on column DBA_JOBS.SCHEMA_USER is
  84. 'select * from bar  means  select * from schema_user.bar ' 
  85. /
  86. comment on column DBA_JOBS.LAST_DATE is
  87. 'Date that this job last successfully executed'
  88. /
  89. comment on column DBA_JOBS.LAST_SEC is
  90. 'Same as LAST_DATE.  This is when the last successful execution started.'
  91. /
  92. comment on column DBA_JOBS.THIS_DATE is
  93. 'Date that this job started executing (usually null if not executing)'
  94. /
  95. comment on column DBA_JOBS.THIS_SEC is
  96. 'Same as THIS_DATE.  This is when the last successful execution started.'
  97. /
  98. comment on column DBA_JOBS.TOTAL_TIME is
  99. 'Total wallclock time spent by the system on this job, in seconds'
  100. /
  101. comment on column DBA_JOBS.NEXT_DATE is
  102. 'Date that this job will next be executed'
  103. /
  104. comment on column DBA_JOBS.NEXT_SEC is
  105. 'Same as NEXT_DATE.  The job becomes due for execution at this time.'
  106. /
  107. comment on column DBA_JOBS.BROKEN is
  108. 'If Y, no attempt is being made to run this job.  See dbms_jobq.broken(job).'
  109. /
  110. comment on column DBA_JOBS.INTERVAL is
  111. 'A date function, evaluated at the start of execution, becomes next NEXT_DATE'
  112. /
  113. comment on column DBA_JOBS.FAILURES is
  114. 'How many times has this job started and failed since its last success?'
  115. /
  116. comment on column DBA_JOBS.WHAT is
  117. 'Body of the anonymous PL/SQL block that this job executes'
  118. /
  119. comment on column DBA_JOBS.CURRENT_SESSION_LABEL is
  120. 'Truste Oracle label of the current session as seen by the job'
  121. /
  122. comment on column DBA_JOBS.CLEARANCE_HI is
  123. 'Highest level of clearance available to the job'
  124. /
  125. comment on column DBA_JOBS.CLEARANCE_LO is
  126. 'Lowest level of clearance available to the job'
  127. /
  128. comment on column DBA_JOBS.NLS_ENV is
  129. 'alter session parameters describing the NLS environment of the job'
  130. /
  131. comment on column DBA_JOBS.MISC_ENV is
  132. 'a versioned raw maintained by the kernel, for other session parameters'
  133. /
  134. drop public synonym DBA_JOBS
  135. /
  136. create public synonym DBA_JOBS for DBA_JOBS
  137. /
  138.  
  139.  
  140. create or replace view USER_JOBS
  141. as select j.* from dba_jobs j where j.priv_user = USER;
  142. /
  143. comment on table USER_JOBS is
  144. 'All jobs owned by this user'
  145. /
  146. comment on column USER_JOBS.JOB is
  147. 'Identifier of job.  Neither import/export nor repeated executions change it.'
  148. /
  149. comment on column USER_JOBS.LOG_USER is
  150. 'USER who was logged in when the job was submitted'
  151. /
  152. comment on column USER_JOBS.PRIV_USER is
  153. 'USER whose default privileges apply to this job'
  154. /
  155. comment on column USER_JOBS.SCHEMA_USER is
  156. 'select * from bar  means  select * from schema_user.bar ' 
  157. /
  158. comment on column USER_JOBS.LAST_DATE is
  159. 'Date that this job last successfully executed'
  160. /
  161. comment on column USER_JOBS.LAST_SEC is
  162. 'Same as LAST_DATE.  This is when the last successful execution started.'
  163. /
  164. comment on column USER_JOBS.THIS_DATE is
  165. 'Date that this job started executing (usually null if not executing)'
  166. /
  167. comment on column USER_JOBS.THIS_SEC is
  168. 'Same as THIS_DATE.  This is when the last successful execution started.'
  169. /
  170. comment on column USER_JOBS.TOTAL_TIME is
  171. 'Total wallclock time spent by the system on this job, in seconds'
  172. /
  173. comment on column USER_JOBS.NEXT_DATE is
  174. 'Date that this job will next be executed'
  175. /
  176. comment on column USER_JOBS.NEXT_SEC is
  177. 'Same as NEXT_DATE.  The job becomes due for execution at this time.'
  178. /
  179. comment on column USER_JOBS.BROKEN is
  180. 'If Y, no attempt is being made to run this job.  See dbms_jobq.broken(job).'
  181. /
  182. comment on column USER_JOBS.INTERVAL is
  183. 'A date function, evaluated at the start of execution, becomes next NEXT_DATE'
  184. /
  185. comment on column USER_JOBS.FAILURES is
  186. 'How many times has this job started and failed since its last success?'
  187. /
  188. comment on column USER_JOBS.WHAT is
  189. 'Body of the anonymous PL/SQL block that this job executes'
  190. /
  191. comment on column USER_JOBS.CURRENT_SESSION_LABEL is
  192. 'Truste Oracle label of the current session as seen by the job'
  193. /
  194. comment on column USER_JOBS.CLEARANCE_HI is
  195. 'Highest level of clearance available to the job'
  196. /
  197. comment on column USER_JOBS.CLEARANCE_LO is
  198. 'Lowest level of clearance available to the job'
  199. /
  200. comment on column USER_JOBS.NLS_ENV is
  201. 'alter session parameters describing the NLS environment of the job'
  202. /
  203. comment on column USER_JOBS.MISC_ENV is
  204. 'a versioned raw maintained by the kernel, for other session parameters'
  205. /
  206. drop public synonym USER_JOBS
  207. /
  208. create public synonym USER_JOBS for USER_JOBS
  209. /
  210. grant select on USER_JOBS to public with grant option
  211. /
  212. drop public synonym ALL_JOBS
  213. /
  214. create public synonym ALL_JOBS for USER_JOBS
  215. /
  216. grant select on ALL_JOBS to public with grant option
  217. /
  218.